<html>
<head><meta charset="utf-8"><title>crate-type=&quot;staticlib&quot; is broken for linux? · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html">crate-type=&quot;staticlib&quot; is broken for linux?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="151180867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151180867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151180867">(Dec 08 2018 at 15:22)</a>:</h4>
<p>I tried currently with the stable build and the <code>.a</code> produced seems bogus, on macos it works as intended, anybody willing to point me where I should look at?</p>



<a name="151180925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151180925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151180925">(Dec 08 2018 at 15:24)</a>:</h4>
<div class="codehilite"><pre><span></span>$ nm target/release/librav1e.a | grep rav1e_
0000000000000000 T rav1e_config_default
0000000000000000 T rav1e_config_parse
0000000000000000 T rav1e_config_unref
0000000000000000 T rav1e_container_sequence_header
0000000000000000 T rav1e_container_sequence_header_unref
0000000000000000 T rav1e_context_new
0000000000000000 T rav1e_context_unref
0000000000000000 T rav1e_frame_fill_plane
0000000000000000 T rav1e_frame_new
0000000000000000 T rav1e_frame_unref
0000000000000000 T rav1e_packet_unref
0000000000000000 T rav1e_receive_packet
0000000000000000 T rav1e_send_frame
</pre></div>


<p>vs</p>
<div class="codehilite"><pre><span></span>$ nm target/release/librav1e.so | grep rav1e_
0000000000011340 T rav1e_config_default
0000000000011440 T rav1e_config_parse
0000000000011430 T rav1e_config_unref
0000000000011a20 T rav1e_container_sequence_header
0000000000011a70 T rav1e_container_sequence_header_unref
0000000000011550 T rav1e_context_new
0000000000011600 T rav1e_context_unref
0000000000011a80 T rav1e_frame_fill_plane
00000000000117d0 T rav1e_frame_new
0000000000011810 T rav1e_frame_unref
0000000000011a10 T rav1e_packet_unref
00000000000118c0 T rav1e_receive_packet
0000000000011830 T rav1e_send_frame
</pre></div>



<a name="151183950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151183950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151183950">(Dec 08 2018 at 16:54)</a>:</h4>
<p>Seems good to me. Are you complaining about offset being shown as 0?</p>



<a name="151187373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151187373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151187373">(Dec 08 2018 at 18:15)</a>:</h4>
<p>the linker complains</p>



<a name="151187537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151187537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151187537">(Dec 08 2018 at 18:18)</a>:</h4>
<p>complains how? Are you sure you pass your libraries to the linker in the right order?</p>



<a name="151187549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151187549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151187549">(Dec 08 2018 at 18:18)</a>:</h4>
<p>I'm sure, the same code on macos works</p>



<a name="151187557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151187557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151187557">(Dec 08 2018 at 18:19)</a>:</h4>
<p>switching from staticlib to cdylib works as well</p>



<a name="151187634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151187634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151187634">(Dec 08 2018 at 18:20)</a>:</h4>
<p>it is only 1 library and the linker complains only about those symbols</p>



<a name="151187786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151187786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151187786">(Dec 08 2018 at 18:23)</a>:</h4>
<p>dropping lto seems to fix it</p>



<a name="151187998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151187998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151187998">(Dec 08 2018 at 18:27)</a>:</h4>
<p>using LTO would explain it, as the static library would get filled with LLVM bytecode rather than actual machine code</p>



<a name="151187999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151187999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151187999">(Dec 08 2018 at 18:27)</a>:</h4>
<p>but the code’s there nevertheless</p>



<a name="151188521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151188521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151188521">(Dec 08 2018 at 18:37)</a>:</h4>
<p>and the linker in use would not use it ^^;</p>



<a name="151188539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151188539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151188539">(Dec 08 2018 at 18:37)</a>:</h4>
<p>let see if travis now is happy and I can go back chasing other funny bugs ^^</p>



<a name="151263131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151263131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151263131">(Dec 10 2018 at 10:32)</a>:</h4>
<p>This is getting quite strange, I cannot it to link again and the lto is still off...</p>



<a name="151263153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151263153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151263153">(Dec 10 2018 at 10:32)</a>:</h4>
<div class="codehilite"><pre><span></span>simple_encoding.c:(.text+0x3e): undefined reference to `rav1e_config_default&#39;
simple_encoding.c:(.text+0x60): undefined reference to `rav1e_config_parse&#39;
simple_encoding.c:(.text+0x6c): undefined reference to `rav1e_context_new&#39;
simple_encoding.c:(.text+0x7c): undefined reference to `rav1e_frame_new&#39;
simple_encoding.c:(.text+0xa8): undefined reference to `rav1e_send_frame&#39;
simple_encoding.c:(.text+0xda): undefined reference to `rav1e_receive_packet&#39;
simple_encoding.c:(.text+0x102): undefined reference to `rav1e_packet_unref&#39;
simple_encoding.c:(.text+0x118): undefined reference to `rav1e_frame_unref&#39;
simple_encoding.c:(.text+0x124): undefined reference to `rav1e_context_unref&#39;
simple_encoding.c:(.text+0x130): undefined reference to `rav1e_config_unref&#39;
collect2: error: ld returned 1 exit status
</pre></div>



<a name="151266961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151266961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151266961">(Dec 10 2018 at 11:50)</a>:</h4>
<p>if somebody is willing to try <a href="https://github.com/lu-zero/crav1e" target="_blank" title="https://github.com/lu-zero/crav1e">here</a> is the code ^^, <code>make examples</code> should take care of everything</p>



<a name="151267532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151267532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151267532">(Dec 10 2018 at 12:02)</a>:</h4>
<p>maybe <code> --print native-static-libs</code> is the problem...</p>



<a name="151267533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/crate-type%3D%22staticlib%22%20is%20broken%20for%20linux%3F/near/151267533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/crate-type.3D.22staticlib.22.20is.20broken.20for.20linux.3F.html#151267533">(Dec 10 2018 at 12:02)</a>:</h4>
<p>no apparently not</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>